package com.auxgroup.hr.front.service.personnal.impl;

import com.auxgroup.hr.front.dao.domain.PsCChiguT;
import com.auxgroup.hr.front.dao.domain.PsCChiguT;
import com.auxgroup.hr.front.dao.domain.PsCPersonalInfoClass;
import com.auxgroup.hr.front.dao.repository.PsCChiguTRepository;
import com.auxgroup.hr.front.dao.repository.PsCChiguTRepository;
import com.auxgroup.hr.front.service.personnal.ChiguTService;
import com.auxgroup.hr.front.service.personnal.EducatTblService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Example;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 持股情况
 */
@Service("chiguTService")
public class ChiguTServiceImpl implements ChiguTService {
	private static final Logger logger = LoggerFactory.getLogger(ChiguTServiceImpl.class);
	
	@Autowired
	private PsCChiguTRepository psCChiguTRepository;


	@Override
	public PsCChiguT getOne(PsCPersonalInfoClass personalInfo) {
		return psCChiguTRepository.findOne(personalInfo);
	}


	@Override
	public PsCChiguT save(PsCChiguT EducatTbl) {
		return psCChiguTRepository.save(EducatTbl);
	}


	@Override
	public Boolean delete(PsCPersonalInfoClass personalInfo) {
		try {
			psCChiguTRepository.delete(personalInfo);
		} catch (Exception e) {
			logger.error("delete chiguT error: personalInfo={}",personalInfo,e);
			return false;
		}
		return true;
	}
	
	
	@Override
	public List<PsCChiguT> getAll(String emplid) {
		PsCChiguT chiguT = new PsCChiguT();
		chiguT.setEmplid(emplid);
		return psCChiguTRepository.findAll(Example.of(chiguT));
	}


	
	
	
}
